All Functions of Week 2

read_excel

{readxl}

Read an Excel file

select

{dplyr}

Select columns from a tibble/data frame

geom_histogram

{GGPLOT2}

Generates a histogram

cut

{base}

Convert Numeric to Factor

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

rm

{base}

Remove objects

read.spss

{foreign}

Read a .sav file (SPSS data)

hist

{graphics}

Plot a simple histogram

range

{base}

Return range of values

recode

{dplyr}

Recode a variable

summary

{base}

Obtain summary statistics or detailed regression output

median

{stats}

Get median of a vector

mutate

{dplyr}

Modify/create a column in a data frame

geom_bar

{GGPLOT2}

Generates a bar chart

names

{base}

Retrieve names of a list/vector

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

sum

{base}

Get sum of numeric values or a vector

desc

{dplyr}

Arrange in descending order

rbind

{base}

Combine R objects by rows

install.packages

{base}

Install R package

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

ordered

{dplyr}

Create an ordered factor

mean

{base}

Get mean of a vector

factor

{base}

Create a factor

min

{base}

Get minimum of a vector

var

{stats}

Calculate variance

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

boxplot

{graphics}

Plot a simple box plot

max

{base}

Get maximum of a vector

ungroup

{dplyr}

Resolve grouping created with “group_by”

plot

{graphics}

Generic function from base R to produce a plot

seq

{base}

Create a sequence

attach

{base}

Attach Set of R Objects to Search Path

filter

{dplyr}

Filter out rows of a data frame according to logical vector

slice

{dplyr}

Subset rows using their positions

is.na

{base}

Check if a value is NA/elements of vector are NA

str

{utils}

Get the structure of an R object

class

{base}

Retrieve class of an R object

sd

{stats}

Get standard deviation of a vector

pie

{graphics}

Creates a basic pie chart

head

{utils}

Show first 5 rows of a data frame

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

setwd

{base}

Set Working Directory

ggplot

{GGPLOT2}

Create a ggplot graph

lprop

{questionr}

Display row percentages of a two-way frequency table

c

{base}

Combine values/vectors into a vector

ifelse

{base}

Return a or b depending on the value of test

freq

{questionr}

Generate frequency tables

cbind

{base}

Combine R objects by columns

labs

{GGPLOT2}

Customise labels in GGPLOT2

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

library

{base}

Load an R package

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

levels

{base}

Get levels of a factor

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

The end!